package com.juyu.miliao.api.dao.mysql;

import java.util.HashMap;
import java.util.Map;
import org.apache.ibatis.session.SqlSession;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;


@Repository
public class BuyPrivateDao {	
	@Autowired
	private SqlSession sqlSession;

	public void insertBuyPrivate(int buyUserId, int privateId){
		Map<String, Object> params = new HashMap<>();
		params.put("buyUserId", buyUserId);
		params.put("privateId", privateId);
		sqlSession.insert("insertBuyPrivate", params);
	}
	public int countByPrivatePhoto(int tokenId, int privateId){
		Map<String, Object> params = new HashMap<>();
		params.put("tokenId", tokenId);
		params.put("privateId", privateId);
		return sqlSession.selectOne("countByPrivatePhoto", params);
	}

	public void deletePrivateByPrivateId(int privateId){
		sqlSession.delete("deletePrivateByPrivateId", privateId);
	}
	
}
